﻿// code04070000.cpp : 条件运算符
//条件运算符的嵌套和优先级

#include <iostream>
using namespace std;

int main()
{
    //允许嵌套
    int grade = 80;
    string finalgrade = (grade > 90) ? "high pass" : (grade < 60) ? "fail" : "pass";

    cout << ((grade < 60) ? "fail" : "pass");   //输出fail或pass
    cout << (grade < 60) ? "fail" : "pass";     //输出0或1
    cout << grade < 60 ? "fail" : "pass";       //报错！cout和60无法比较
}

